//
//  TNMenberMarkHistoryView.m
//  跑跑快销
//
//  Created by ylife on 14-4-30.
//  Copyright (c) 2014年 ylife. All rights reserved.
//

#define CalendarHeight  60 //日历按钮高度
#import "TNMenberMarkHistoryView.h"
#import "TNMarkHistoryTableViewCell.h"

@implementation TNMenberMarkHistoryView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        [self createTableView];
        [self createMapView];
        [self createCalendarView];
        [self hideMapView];
    }
    return self;
}

- (void)createTableView
{
    _markHistoryTableView = [[UITableView alloc]initWithFrame:CGRectMake(0,CalendarHeight, 320, PHONESIZEHEIGHT - STARTY - CalendarHeight) style:UITableViewStylePlain];
    [_markHistoryTableView registerClass:[TNMarkHistoryTableViewCell class] forCellReuseIdentifier:@"markHistoryCell"];
    //设置分割线风格
    _markHistoryTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self addSubview:_markHistoryTableView];
}

- (void)createMapView
{
    _mapView = [[BMKMapView alloc]initWithFrame:CGRectMake(0, CalendarHeight, 320, PHONESIZEHEIGHT - STARTY - CalendarHeight)];
    [self addSubview:_mapView];
   
}

- (void)createCalendarView
{
    _calendarView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, CalendarHeight)];
    _calendarLable = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 320, CalendarHeight)];
    [_calendarLable setTextAlignment:NSTextAlignmentCenter];
    [_calendarView addSubview:_calendarLable];
    _dateChooseButton = [[UIButton alloc]initWithFrame:CGRectMake(270, 0, 50, CalendarHeight)];
    [_dateChooseButton setImage:[UIImage imageNamed:@"c.png"] forState:UIControlStateNormal];
    [_calendarView addSubview:_dateChooseButton];
    
    [self addSubview:_calendarView];
}

- (void)hideMapView
{
    [_mapView setHidden:YES];
}

- (void)showMapView
{
    [_mapView setHidden:NO];
}

//隐藏签到历史列表
- (void)hideTableView
{
    [_markHistoryTableView setHidden:YES];
}

//显示签到历史列表
- (void)showTableView
{
    [_markHistoryTableView setHidden:NO];
}
@end
